package com.xxwu.springblogsystem.model;

import com.xxwu.springblogsystem.utils.DateUtils;
import lombok.Data;

import java.util.Date;
@Data
public class Blog {
        public Blog() {
        }

        private Integer id;
        private String title;
        private String content;
        private Integer userId;
        private Integer deleteFlag;
        private Integer loginUser = 0;
        private Date createTime;
        private Date updateTime;

        public Blog(Integer id, String title, String content) {
                this.id = id;
                this.title = title;
                this.content = content;
        }

        @Override
        public String toString() {
                return "Blog{" +
                        "id=" + id +
                        ", title='" + title + '\'' +
                        ", content='" + content + '\'' +
                        ", userId=" + userId +
                        ", deleteFlag=" + deleteFlag +
                        ", loginUser=" + loginUser +
                        ", createTime=" + createTime +
                        ", updateTime=" + updateTime +
                        '}';
        }

        //将日期转换为固定格式
        public String getCreateTime() {
                return DateUtils.DateTrans(createTime);
        }
}
